<?php
include_once(_APP_PATH. "modules/controlls/controllers/params/params_field.php");
class ParamsFieldMultiSelect extends ParamsField{

	public function PreparePostData($fieldPostData)
	{
		$fieldPostData = (array) $fieldPostData;
		
		$values = (array)$this->GetParam('values');
		$resValue = array();
		foreach ($fieldPostData as $postVal)
		{		
			foreach ($values as $value => $data)
			{
				if ((is_array($data) && array_key_exists($postVal, $data)) 
					|| ($value == $postVal))
				{
					$resValue[] = $postVal;
					break;	
				}						
			}
		}			
		
		return $resValue; 
	}
	
	public function PrepareOutData($fieldData)
	{
		return (array)$fieldData;
	}	

}